<%@page import="com.tubeonfire.util.ApplicationHelper"%>
<%@page import="com.tubeonfire.entity.Page"%>
<%@page import="com.tubeonfire.model.PageModel"%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.google.appengine.api.users.User"%>
<%@page import="com.google.appengine.api.users.UserServiceFactory"%>
<%@page import="com.google.appengine.api.users.UserService"%>  
<%
	PageModel pageModel = new PageModel();
	pageModel.prepareList();
	String siteName = "";
	if(request.getParameter("siteName")!=null){
		siteName = " - " + request.getParameter("siteName");
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>			
	<meta name="google-site-verification" content="nsm1oO0nHpwApxPddeeOBpMX0FKJZ5x4tHo8T9qVYF8" />
	<title><%=request.getParameter("pageTitle") %><%=siteName %></title>	
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<meta name="title" content="<%=request.getParameter("pageTitle")%>"/>			
	<meta name="description" content="<%=request.getParameter("pageDescription")%>"/>
	<meta name="keywords" content="<%= request.getParameter("pageKeyword")%>"/>	
	<meta name="generator" content="Tubeonfire 1.0.1"/>
		
	<meta property="og:url" content="<%=request.getParameter("pageUrl")%>"/>
	<meta property="og:title" content="<%=request.getParameter("pageTitle")%>"/>	
	<meta property="og:image" content="<%=request.getParameter("pageImages")%>"/> 	
	<meta property="og:description" content="<%=request.getParameter("pageDescription")%>"/>
	<meta property="og:site_name" content="<%=request.getServerName()%>"/>
	<meta property="fb:admins" content="<%=request.getParameter("facebookAdminId")%>" name="<%=request.getParameter("facebookAdminId")%>"/>	
	
	<link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />	
	<link rel="alternate" type="application/rss+xml" title="<%=request.getParameter("pageName")%> - RSS" href="http://<%=request.getServerName() %>/rss" />
	<link rel="stylesheet" type="text/css" href="/css/style.css" />    		
	<link rel="stylesheet" type="text/css" href="/fancybox/source/jquery.fancybox.css" media="screen" />
	
	<script type="text/javascript" src="/js/jquery-1.6.1.min.js"></script>	
	<script type="text/javascript" src="/fancybox/source/jquery.fancybox.js"></script>		 	 		
</head>

<body>	
	<div id="master">
    	<div id="top">
        	<div id="top_inner">
        		<div id="logo">
        			<a href="/">
        				<img src="<%=request.getParameter("pageLogoUrl") %>" alt="Tubeonfire" title="<%=request.getParameter("pageLogoSlogan") %>" />
        			</a>        			
                </div>
                <nav>
                    <ul id="mainmenu" class="clearafter">                    	
                    	<li><a href="/">Home</a></li>
                    	<li>
                    		<a href="/tubes">Browse Video</a>
                    		<ul>
                    			<li><a href="/most-view">Most View</a></li>
                    			<li><a href="/tubes">Newest</a></li>  	
                    			<li><a href="/list-author">By Author</a></li>
                    			<li><a href="/list-channel">By Channel</a></li>                                   	
                    		</ul>
                    	</li>                       	       	                    	              
                        <li><a href="/list-playlist">All Playlist</a></li>                                                  
                        <li><a href="/contact-us">Contact Us</a></li> 	        
                        <%
                        	if(pageModel.getListResult().size()>0){
                        %>
                        <li>
                        	<a href="#">More</a>          
                        	<ul>		
                        <%
                        		for(Page p : pageModel.getListResult()){
                        %>
                        		<li><a href="/page/<%=p.getId()%>/<%=p.getAlias()%>"><%=p.getTitle() %></a></li>      		
                        <%
                        		}
                        %>
                        	</ul>
                        </li>
                        <%
                        	}
                        %>  
                        <%
							UserService userService = UserServiceFactory.getUserService();
							User user = userService.getCurrentUser();
							if(user!=null&&userService.isUserAdmin()){
						%>
						<li class="hello-admin"><a href="/admin" style="color: #FFB515;">Admin Page</a></li>						
						<%
							}
						%>                                                                                                                               
                    </ul>
                </nav>
                <div class="clearbreak"></div>
            </div>
        </div>
        
        <div id="toolbar">
        	<div id="toolbar_inner">
            	<div id="toolbar_inner1" class="clearafter">
                    <div id="social-icons">                    
                        <!-- AddThis Button BEGIN -->
						<div class="addthis_toolbox addthis_default_style ">
							<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
							<a class="addthis_button_tweet" tw:via=""></a> 
							<a class="addthis_button_google_plusone" g:plusone:size="medium"></a> 
							<a class="addthis_counter addthis_pill_style"></a>
						</div>
						<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4ef062a536300433"></script>
						<!-- AddThis Button END -->
                    </div>
                    <div id="search">
                    	 <form action="" method="get" onsubmit="location.href='/search/' + encodeURIComponent(this.tag.value).replace(/%20/g, '+'); return false;">                    	
	                    	<input type="text" name="tag" value="search tubes" onfocus="if (this.value == 'search tubes') {this.value = '';}" onblur="if (this.value == '') {this.value = 'search tubes';}" />	                    	
	                    </form>
                    </div>
                </div>
            </div>
        </div>